Repository navigation
Conversation
…three exporters (#3469) Replace the unchecked opt() helper (flag token accepted as a value and consumed twice via indexOf) with an exported single-pass parseArgs(): a value flag followed by another flag or by nothing is a usage error naming the flag (stderr + exit 2) before any directory creation, token resolution, or API/CDP call; unknown flags and bare positionals are usage errors; meta --cdp-port must be a decimal integer in 1-65535. Regression tests in each exporter's *.test.mjs cover flag-as-value, trailing flag, double consumption, port range (meta), unknown flags, and the control invocation.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
CI coverage note: this change is class 2 package source under .github/ci-policy.md, which calls for affected-package tests. The current .github/workflows/pm-stack-tests.yml trigger is push-to-main only, not pull_request, so the three exporter suites do not run on this PR. I ran them locally on the laptop (meta 27/27, Cloudflare 31/31, Supabase 17/17). Current PR check list has only the basic OpenCode metered-provider guard (queued) plus CodeRabbit skipping; exporter-test CI coverage is absent. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Superseded by #9009 — closing per the duplicate protocol. This PR (task 6120's branch) implemented the #3469 strict-argv fix, but its base diverged: since 2026-11-08, main gained the CDP readiness probe in the meta exporter and secret-based project-ref resolution ( Diff comparison: #9009 covers the identical file set (all three exporters + all three test files) with the same semantics — single-pass parseArgs, flag-as-value = usage error naming the flag, exit 2 before any side effect, meta --cdp-port decimal 1–65535 — ported onto current main, with this PR's argv test suites carried over (adapted only where main's refactors changed the surface: supabase parseArgs returns the unresolved refOverride so main's flag → env → secret resolution order is preserved). Tests on #9009: meta 98 pass, cloudflare 102 pass, supabase 50 pass / 3 live-only skips. |
Fixes #3469 (queue task 6120).
All three quota exporters shared an unchecked
opt()helper that took the next argv token as a flag's value verbatim — a flag token was accepted as a value and consumed twice viaindexOf, and meta's--cdp-portwasNumber()-converted with no validation (banana→ NaN CDP outage report).Change
Each exporter gains an exported single-pass
parseArgs(argv)(throwsExportError("usage", 2);main()turns it into stderr + exit 2 before any directory creation, token resolution, or API/CDP call):--flagtoken or by nothing → usage error naming the flag--cdp-portmust be a plain decimal integer in 1–65535--flagsand bare positionals are usage errors (never silently ignored)ExecStartshapes verified unchanged (all parse)Tests
node --test pm-stack/meta-exporter/meta-quota-export.test.mjs— 27/27 (6 new)node --test pm-stack/cloudflare-export/cloudflare-quota-export.test.mjs— 31/31 (5 new)bun test pm-stack/supabase-export/supabase-quota-export.test.mjs— 17/17 (5 new)--out-dir outcontrol writesout/latest.json+history.jsonlin all three (meta: live ok; CF/SB: failure docs correctly routed to the named dir).Labels/state
Task 6120 · lane openchamber-scheduled-aea12c82
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.